/**
 * 添加一个Ext.Msg.ghost提示方法
 */
Ext.MyApp = function(){
    var msgCt;

    function createBox(t, s){
        return ['<div class="msg">',
            '<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
            '<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>', t, '</h3>', s,
            '</div></div></div>', '<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
            '</div>'].join('');
    }
    return {
        ghost : function(title, format){
            if(!msgCt){
                msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
            }
            msgCt.center();
            var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
            var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true);
            m.slideIn('t').highlight().pause(2).ghost("t", {remove:true});
        }
    };
}();
Ext.Msg.ghost=Ext.MyApp.ghost;

Ext.Ajax.on('requestcomplete',checkUserSessionStatus, this);
function checkUserSessionStatus(conn,response,options){
    //Ext重新封装了response对象
    if(response.getResponseHeader !=null && response.getResponseHeader('sessionstatus')){
        alert("出于安全原因，请重新登录！");
        //发现请求超时，退出处理代码...
        var win = window;
        while (win != win.parent){
            win = win.parent;
        }
        win.location = "index.jsp";
    }
}